<script setup lang="ts" name="Home">
  import {ref,computed} from 'vue'
  let sum = ref(0)
  //计算属性 - 采用组合式api
  let bigSum = computed({
    get(){
      console.log('getter')
      return sum.value*10;
    },
    set(v){
      console.log('setter',v)
      sum.value = v
    }
  })

  //不需要修改,只读
  //bigSum就是计算属性点值,可以直接在模板当中使用的
  //let bigSum = computed(()=>sum.value*10)
</script>


<template>
    <button @click="sum++">sum+1</button>
    <h1>初始值:{{sum}}</h1>
    <h3>放大后:{{ bigSum }}</h3>
</template>
<style scoped>
</style>